<?php
namespace app\msgapi\controller;

use app\msgapi\service\HsadminService;
use app\Request;

class Hsadmin extends Base
{
    public function __construct(HsadminService $service)
    {
        parent::__construct($service);
        $this->service = $service;
    }

    /**获取管理员可见账号
     * @param Request $request
     * @return \app\msgapi\model\AdminUser|array|\think\response\Json
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getAdminAccount(Request $request)
    {
        return $this->service::getAdminAccount($request->admin_groupid,$request->adminid);
    }

    /**
     * 生成账号
     * @param Request $request
     * @return \think\response\Json
     */
    public function accountGenerator(Request $request)
    {
        $data = $request->only(['userid','type','password','confirm_password','group_id','deparment_lst','user_lst','auth_range'],'post');
        return $this->service->accountGenerator($data);
    }

    /**
     * 获取已绑定userid
     * @return \think\response\Json
     */
    public function getBindUserList()
    {
        return $this->service->getBindUserList();
    }
}